import java.util.Scanner;
import java.util.Arrays;

//4.27 太难了 需要去看看dfs算法
public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int n = sc.nextInt();
            int[] arr = new int[n];
            for(int i = 0; i < n; i++){
                arr[i] = sc.nextInt();
            }
            Arrays.sort(arr);
            System.out.println(dfs(arr,0,0,1));
        }
    }
    
    public static int dfs(int[] a, int index, long sum, long multi){
        int count = 0; //表示
        for(int i = index; i < a.length; i++){
            sum += a[i];
            multi *= a[i];
            if(sum > multi){    //目前幸运接着递归
                count = count + 1 + dfs(a, i+1, sum, multi);
            }else if(a[i] ==1){
                count = count + dfs(a, i+1, sum, multi);
            }else{     //不幸运退出
                break;
            }
            sum -= a[i];
            multi /= a[i];
            for(; i < a.length - 1 && a[i] == a[i + 1]; i++){
            }
        }
        return count;
    }
}